
////.........当前代码为程序自动生成,请勿手动修改.......
////.........一维数组分割符=[◆ ⧫, ，=]........_二维数组分割符=[✚ + @ &  ; ；]
////.........字段类型添加参数..使用问号分割....(?f/?find)=(搜索字段).....
////.........0行0列..可以填写父类的名字...也可添加参数.(?f)=(显示字段索引).....
////.........表名.说明.....名字与后缀中文的分隔符....'&', '$', '@'.......【ResCfg@资源表】
////.........覆盖表.说明.......表名中间增加一个字段.......【ResCfg@art07@资源表】


using System;
using System.Collections.Generic;
using System.Linq;
using CSUtils;
using CSUtils.WeProtoCore;
//using UnityEngine;
using G02.SceneConfig;
/// <summary>
/// G02.SceneConfig
/// </summary>
namespace G02.SceneConfig {
	/// <summary>
	/// Cfg_Scene
	/// </summary>
	public partial class Cfg_Scene: CExcelCfg {

		public const string _tag = "[G02.SceneConfig.xlsx/Cfg_Scene]";
		/// <summary>
		/// 地形表
		/// </summary>
		public int id { get; protected set; }
		/// <summary>
		/// 地形唯一资源路径
		/// </summary>
		public string onlyAssetsPath { get; protected set; }
		/// <summary>
		/// 下一个id字段
		/// </summary>
		public Cfg_Scene _nextCfg { get; protected set; }


		public static Cfg_Scene[] arr{
			get {
				if (_arr == null) {
					__InitParent();
					_arr = id_cfgDic.Values.ToArray();;
				}
				return _arr;
			}
		}
		static Cfg_Scene[] _arr;
		public static Cfg_Scene firstCfg{ get; protected set; }
		public static Dictionary<int,Cfg_Scene> GetDic(){
			return id_cfgDic;
		}
		protected static Dictionary<int,Cfg_Scene> id_cfgDic = new Dictionary<int, Cfg_Scene>();
		public Cfg_Scene(){}
		public Cfg_Scene( int id, string onlyAssetsPath){
			this.id = id;
			this.onlyAssetsPath = onlyAssetsPath;
			__InitC(this);
			G02.SceneConfig.Cfg_Scene.id_cfgDic[id] = this;
		}
		static Cfg_Scene () {
			__InitParent();
		}
		internal static void __InitParent() {
			__InitSub();
		}
		static bool __isInit;
		public static void __InitSub() {
			if(__isInit)return;
			__isInit = true;
			//id_cfgDic.Clear();
			new Cfg_Scene(1, @"TripleJump/Model/11_Terrain/-2_11_1_0_startTerrain.prefab");
			new Cfg_Scene(2, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(3, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(4, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(5, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(6, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(7, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(8, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(9, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(10, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(11, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(12, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(13, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(14, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(15, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(16, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(17, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(18, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(19, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(20, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(21, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(22, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(23, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(24, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(25, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(26, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(27, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(28, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(29, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(30, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(31, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(32, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			new Cfg_Scene(33, @"TripleJump/Model/11_Terrain/-2_11_32_0_Chun.prefab");
			//G02.SceneConfig.Cfg_Scene._arr = G02.SceneConfig.Cfg_Scene.id_cfgDic.Values.ToArray();
		}
		public Cfg_Scene Clone(Cfg_Scene cfg = null) => CopyTo(cfg);
		bool _isClone;
		public Cfg_Scene CopyTo(Cfg_Scene cfg = null){
			if (cfg == null) {
			   cfg = new Cfg_Scene();
			   cfg._isClone = true;
			} else {
			   if (cfg._isClone == false) {
			      CLog.Ex(_tag,$"原始数据..无法修改....{_tag}");
			      return null;
			   }
			}
			cfg.id = id;
			cfg.onlyAssetsPath = onlyAssetsPath;
			return cfg;
		}
		public virtual object this[int fieldIndex]{
			set{
				if (_isClone == false) {
					CLog.E(_tag,$"bu不是克隆表格....无法设置...fieldIndex={fieldIndex}.....{value}");
					return;
				}
				try{
					switch (fieldIndex) {
						case 1: //ECSType.eint
							id = Convert.ToInt32(value);
							break;
						case 5: //ECSType.estring
							onlyAssetsPath = Convert.ToString(value);
							break;
					}
				} catch(Exception ex){
					var st = new System.Diagnostics.StackTrace(true);
					    CLog.Ex($"Cfg_Scene",$"设置数据错误......index={fieldIndex}.....value={value}", ex, st);
				}
			}
		}

        static Cfg_Scene __upCfg;
        static void __InitC(Cfg_Scene cfg) {
            if (firstCfg == null) {
                firstCfg = cfg;
            }
            if (__upCfg != null) {
                __upCfg._nextCfg = cfg; 
            }
            __upCfg = cfg;
        }

		public static Cfg_Scene Get(int id, string noExistErrorLog ="", bool isForceGet = false) {
			if(id_cfgDic.Count == 0) { __InitParent();}
			if(id_cfgDic.TryGetValue(id, out var cfg)){
				return cfg;
			}
			if(noExistErrorLog!=null) { CLog.E(_tag,$"加载表格失败..id不存在......id={id}.......{noExistErrorLog}");}
			if(isForceGet) { return arr[id.GetHashCode() % arr.Length]; }
			return null;
		}
		public static bool IsHave(int id) {
			if(id_cfgDic.Count == 0) { __InitParent();}
			return id_cfgDic.ContainsKey(id);
		}
		public static void _ClearAll(bool isReload = false) {
		    firstCfg = null;
		    _arr = null;
		    id_cfgDic.Clear();
		    if (isReload) { __isInit = false; }
		}
		public override string ToString() {
		    return $"Cfg_Scene.{id}/{onlyAssetsPath}";
		}
	}

}